<script>
import Print from "@/components/PurchaseIncoming/print.vue";

export default {
  props: ["printDialogVisible", "templateData"],
  components: {Print},
  watch: {
    printDialogVisible() {
      if (this.printDialogVisible) {
        this.printDialog.printDialogVisible = this.printDialogVisible;
        this.printDialog.templateData = this.templateData;
      }
    },
  },
  data() {
    return {
      printDialog: {
        templateData: {
          templateTypeName: '',
          templateID: '',
          template: {},
        },
        printDialogVisible: false,
      },
    }
  },
  methods: {
    printDialogStatus(v) {
      this.printDialog.printDialogVisible = v;
      this.$emit('setPrintData', {
        printDialogVisible: v,
      });
    },
  }
}
</script>

<template>
  <el-dialog style="margin-top: 10px;" custom-class="no-header-dialog"
             :fullscreen="true"
             :close-on-click-modal="false"
             width="95%" v-dialog-drag append-to-body
             title="编辑进货单" :show-close="false"
             :visible.sync="printDialog.printDialogVisible">
    <span slot="title"></span>
    <print v-if="printDialog.printDialogVisible" :templateData="printDialog.templateData" @printDialogStatus="printDialogStatus"/>
  </el-dialog>
</template>

<style scoped lang="scss">

</style>
